package com.evil.kingdom.pojo.dto.person.general;

import com.evil.kingdom.pojo.dto.person.base.PersonDto;
import com.evil.kingdom.pojo.dto.person.base.PersonTypeDto;
import com.evil.kingdom.pojo.dto.person.soldier.SoldierDto;
import com.evil.kingdom.pojo.entity.base.Loyalty;
import com.evil.common.mongo.entity.SingleName;
import com.evil.kingdom.pojo.entity.tactics.Tactics;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * 武将
 *
 * @author liyang
 * @date 2024-05-17 16:50
 */
@Getter
@Setter
public class GeneralDto extends PersonDto implements SingleName, Loyalty, PersonTypeDto {

    /**
     * 归属（君主）
     *
     * @see PersonDto#getName()
     */
    private String belong;

    /**
     * 忠诚度（0-100）
     */
    private Integer loyalty;

    /**
     * 已习得战术列表
     */
    private Set<Tactics> tactics;

    /**
     * 士兵
     */
    private Set<SoldierDto> soldierSet;

    public GeneralDto() {
        soldierSet = new HashSet<>();
    }

    @Override
    public String getEntityName() {
        return "武将";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        GeneralDto that = (GeneralDto) o;

        return Objects.equals(this.getName(), that.getName());
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
